package com.itheima.health.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.health.dao.CheckitemDao;
import com.itheima.health.entity.PageResult;
import com.itheima.health.entity.QueryPageBean;
import com.itheima.health.pojo.CheckItem;
import com.itheima.health.service.CheckitemService;
import org.springframework.beans.factory.annotation.Autowired;
@Service
public class CheckitemServiceImpl implements CheckitemService {
    @Autowired
    private CheckitemDao checkitemDao;
    @Override
    public PageResult pageQuery(QueryPageBean queryPageBean) {
        //使用PageHelper工具类设置分页查询limit条件
        PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize());
        //调用dao实现查询数据
       Page<CheckItem> page=checkitemDao.selectByCondition(queryPageBean.getQueryString());
        //返回PageResult对象

        return new PageResult(page.getTotal(),page.getResult());
    }

    @Override
    public void add(CheckItem checkItem) {
        checkitemDao.add(checkItem);
    }
}
